﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class ucControl_ucLienHe : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void cmdSubmit_Click(object sender, ImageClickEventArgs e)
    {
        EmailService emailSrv = new EmailService();
        string strMessage = txtMsg.Text.Trim();
        string strMessageCustomer = txtMsg.Text.Trim();

        //Send to specified department
        emailSrv.SendContactUsEmail(txtName.Text.Trim(),
                                    txtPhone.Text.Trim(),
                                    txtEmail.Text.Trim(),
                                    Global.CONTACT_EMAIL_ADDRESS,
                                    txtSubject.Text.Trim(),
                                    strMessageCustomer,
                                    Server.MapPath(Global.CONTACT_US));
        //Send thanking email to customer
        emailSrv.SendContactUsEmail(txtName.Text.Trim(),
                                    txtPhone.Text.Trim(),
                                    "",
                                    txtEmail.Text,
                                    txtSubject.Text.Trim(),
                                    strMessageCustomer,
                                    Server.MapPath(Global.CONTACT_US_THANK_YOU));
        ScriptManager.RegisterStartupScript(cmdSubmit, cmdSubmit.GetType(), "alert", "alert('Cảm ơn bạn đã liên hệ với chúng tôi.');", true);
        txtName.Text = txtPhone.Text = txtEmail.Text = txtSubject.Text = txtMsg.Text = "";
    }
}
